<template>
  <div style="width: 100%; height: calc(100vh - 60px);">
    <yly-form-render
      :renderScene="'edit'"
      :formCode="formCode"
      :queryParams="queryParams"
      :loadFormConfig="loadFormConfig"
    />
  </div>
</template>

<script>
import YlyFormRender from '@/packages/yly-form-render/yly-form-render.vue'

export default {
  name: 'DemoFormEdit',
  components: {
    YlyFormRender
  },
  provide() {
    return {
    }
  },
  data(){
    return {
      renderScene: 'edit',
      formConfigData: {},
      formCode: '',
      queryParams: {
        id: '1822903233153097729'
      }
    }
  },
  computed:{
  },
  created(){
    import('./demo-form-config').then(res => {
      this.formConfigData = res.default
      this.formCode = this.formConfigData.formPageConfig.formCode
    }).catch((err) => {
      console.error(err)
    })
  },
  methods:{
    loadFormConfig() {
      return new Promise((resolve, reject) => {
        import('./demo-form-config').then(res => {
        this.formConfigData = res.default
        this.formCode = this.formConfigData.formPageConfig.formCode
        resolve(this.formConfigData)
      }).catch((err) => {
        console.error(err)
      })
      })
    }
  }
}
</script>

<style lang="scss">
</style>
